<template>
  <div class="home"> 
    
    <van-tabs v-model="active">
      <van-tab title="点餐">
        <Dish ></Dish>
      </van-tab>
      <van-tab title="评价">
        <Comment></Comment>
      </van-tab>
      <van-tab title="商家">
        <Shop></Shop>
      </van-tab>
    </van-tabs>
    
  </div>
</template>

<script>
import Dish from "../components/Dish";
import Comment from "../components/Comment";
import Shop from "../components/Shop";
import {  mapState,mapActions } from "vuex";
export default {
  components: {
    Dish,
    Comment,
    Shop,
  },
  methods:{
    ...mapActions(['getDishList'])
  },
  computed: {
    ...mapState(["dish_list","flag"]),
  },
  created(){
    console.log('home created');
    if(!this.dish_list.length){
      this.getDishList();
    }
    
  },

  data() {
    return {
      active: 0,
    };
  },

 
};
</script>
<style scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>